home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / fileOptions.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  39.9 KB  |  1,258 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  December 3, 1996
  22. //  Author:         DSW
  23. //
  24. //  Description:
  25. //      File option box script.
  26. //
  27. //  Input Arguments:
  28. //      String        The action being performed.
  29. //                    Open, Import, Reference, ExportAll, ExportActive, Save
  30. //  Return Value:
  31. //      None. Invokes the file browser.
  32. //
  33.  
  34. global string $gFileOptionsString;
  35. global string $gAllOptionStrings[];
  36. global int $gLastOptionSelectionIndex;
  37. global string $gLastOptionSelection;
  38.  
  39. global proc fo_prefixName ( string $action ) 
  40. //
  41. //    Description:
  42. //        this proc is invoked when the prefix field is changed.
  43. //
  44. {
  45.     // Determine which field is selected.
  46.     int $selected = `optionMenu -q -sl nameClash2OptionMenu`;
  47.     if ($selected == 1) {
  48.         // if "the fileName" is selected then make the edit field invisible.
  49.         textField -e -vis false nodeNamePrefix;
  50.     } else {
  51.         // else make the edit field visible and fill with the option var
  52.         textField -e -vis true nodeNamePrefix;
  53.  
  54.         string $renamePrefixOptionVar = ($action == "Reference" ? "referenceOptionsRenamePrefix" : "fileOptionsRenamePrefix");
  55.         string $userPrefixStr = `optionVar -q $renamePrefixOptionVar`;
  56.         textField  -e -tx $userPrefixStr nodeNamePrefix;
  57.     }
  58. }
  59.  
  60. global proc fo_exportActiveNSMenuChange () 
  61. //
  62. //    Description:
  63. //        this proc is invoked when foExportActiveNSMenu is changed.
  64. //
  65. {
  66.     // Determine which field is selected.
  67.     int $selected = `optionMenuGrp -q -sl foExportActiveNSMenu`;
  68.     if ($selected == 1) {
  69.         //    if "the fileName" is selected then make the edit field invisible.
  70.         textField -e -vis false foExportActiveNSFld;
  71.     } else {
  72.         // else make the edit field visible and fill with the option var
  73.         textField -e -vis true foExportActiveNSFld;
  74.  
  75.         string $userPrefixStr = `optionVar -q exportOptionsRenamePrefix`;
  76.         textField  -e -tx $userPrefixStr foExportActiveNSFld;
  77.     }
  78. }
  79.  
  80. global proc fo_exportActiveKeepRefChanged()
  81. //
  82. //    Description:
  83. //        If the "Keep Only a Reference" box is checked on, then enable
  84. //        some UI controls; Otherwise diable the controls.
  85. //
  86. {
  87.     int $val = `checkBoxGrp -query -v1 exKeepRefBox`;
  88.     if ($val > 0) {
  89.         columnLayout -edit -enable on foExportActiveReferenceLyt;
  90.     } else {
  91.         columnLayout -edit -enable off foExportActiveReferenceLyt;
  92.     }
  93. }
  94.  
  95. global proc int fo_optionsCallback ( string $newOptionsString )
  96. //
  97. //    Description:
  98. //        Set the file options string for the current translator.
  99. //
  100. {
  101.     global string $gFileOptionsString;
  102.     
  103.     $gFileOptionsString = $newOptionsString;
  104.     
  105.     return 1;    
  106. }
  107.  
  108. global proc int fo_newFileType ( string $action )
  109. //
  110. //    Description:
  111. //        This is the callback for the file type list.
  112. //
  113. {
  114.     string $newItem;
  115.     string $optionsScript;
  116.     int $numChildren;
  117.     string $childArray[];
  118.     string $initialSettings;
  119.     global int $gLastOptionSelectionIndex;
  120.     global string $gLastOptionSelection;
  121.     global string $gAllOptionStrings[];
  122.     global string $gFileOptionsString;
  123.     string $lastOptions;
  124.  
  125.     setParent fileOptionsScroll;
  126.     
  127.     if ($gLastOptionSelectionIndex >= 0) {
  128.         // Grab the last posted options before clearing.
  129.  
  130.         // Reselect the old item.
  131.         if ($gLastOptionSelection != "Best Guess") {
  132.             // Get the option Script.
  133.             $optionsScript = `translator -q -os $gLastOptionSelection`;
  134.         }
  135.  
  136.         if ($optionsScript != "") {
  137.             // Get the new options.
  138.             // Sets $gFileOptionsString
  139.             eval($optionsScript+" fileOptionsScroll \"query\" \"\" fo_optionsCallback");
  140.         } else {
  141.             $gFileOptionsString = "";
  142.         }
  143.         $gAllOptionStrings[$gLastOptionSelectionIndex] = $gFileOptionsString;
  144.     }
  145.  
  146.     $newItem = `optionMenuGrp -q -v fo_fileTypePopList`;
  147.  
  148.     // Clear out the options block.
  149.     $numChildren = `columnLayout -q -nch fileOptionsScroll`;
  150.     if ($numChildren > 0) {
  151.         $childArray = `columnLayout -q -ca fileOptionsScroll`;
  152.         string $aChildControl;
  153.         for ($aChildControl in $childArray) {
  154.             deleteUI $aChildControl;
  155.         }
  156.     }
  157.     
  158.     if ($newItem != "Best Guess") {
  159.         string $translatorList[] = `translator -q -l`;
  160.         int $numTranslators = size($translatorList);
  161.         int $index = 0;
  162.         for ($index = 0; $index < $numTranslators; $index++) {
  163.             if ($translatorList[$index] == $newItem) {
  164.                 $gLastOptionSelectionIndex = $index;
  165.                 break;
  166.             }
  167.         }
  168.         $gLastOptionSelection = $newItem;
  169.         $optionsScript = `translator -q -os $newItem`;
  170.     } else {
  171.         $optionsScript = "";
  172.         $gLastOptionSelectionIndex = -1;
  173.     }
  174.  
  175.     separator -w 490;
  176.     text -l "File Type Specific Options:";
  177.     
  178.     if ($optionsScript != "") {
  179.         // Post the new options.
  180.         $initialSettings = $gAllOptionStrings[$gLastOptionSelectionIndex];
  181.         eval($optionsScript+" fileOptionsScroll \"post\" \""+$initialSettings+"\" fo_optionsCallback");
  182.     } else {
  183.         text -l "          No Options Available" noSaveOptionsText;
  184.     }
  185.  
  186.     if ($action == "ExportActive") {
  187.  
  188.         switch ($newItem) {
  189.         case    "Best Guess"    :
  190.         case    "mayaAscii"        :
  191.         case    "mayaPLE"        :
  192.         case    "mayaBinary"    :
  193.             // Reset the checkboxes to the value they had the last
  194.             // time they were used.
  195.             checkBoxGrp -edit
  196.                 -en on -v1 `optionVar -query exportKeepOnlyRef`
  197.                 exKeepRefBox;
  198.  
  199.             int $exportIncludeInputs = `optionVar -query exportIncludeInputs`;    
  200.             checkBoxGrp -edit
  201.                 -en on -v1 $exportIncludeInputs
  202.                 exInInputsBox;
  203.  
  204.             // If the "Include These Inputs" box is enabled, then enable
  205.             // and reset the sub options.  Otherwise disable the suboptions
  206.             // and turn them off.
  207.             if ( $exportIncludeInputs ) {
  208.                 checkBoxGrp -edit
  209.                     -en on -v1 `optionVar -query exportIncludeHistory`
  210.                     exInHistoryBox;
  211.  
  212.                 checkBoxGrp -edit
  213.                     -en on -v1 `optionVar -query exportIncludeChannels`
  214.                     exInChannelsBox;
  215.  
  216.                 checkBoxGrp -edit
  217.                     -en on -v1 `optionVar -query exportIncludeExpressions`
  218.                     exInExpressionsBox;
  219.  
  220.                 checkBoxGrp -edit
  221.                     -en on -v1 `optionVar -query exportIncludeConstraints`
  222.                     exInConstraintsBox;
  223.             } else {
  224.                 checkBoxGrp -e -en off -v1 false exInHistoryBox;
  225.                 checkBoxGrp -e -en off -v1 false exInChannelsBox;
  226.                 checkBoxGrp -e -en off -v1 false exInExpressionsBox;
  227.                 checkBoxGrp -e -en off -v1 false exInConstraintsBox;
  228.             }
  229.  
  230.             checkBoxGrp -edit
  231.                 -en on -v1 `optionVar -query exportIncludeShaders`
  232.                 exInShadersBox;
  233.             break;
  234.         default                    :
  235.             // Other formats do not support the export filters.
  236.             checkBoxGrp -e -en off -v1 false exKeepRefBox;
  237.             checkBoxGrp -e -en off -v1 false exInInputsBox;
  238.             checkBoxGrp -e -en off -v1 false exInHistoryBox;
  239.             checkBoxGrp -e -en off -v1 false exInChannelsBox;
  240.             checkBoxGrp -e -en off -v1 false exInExpressionsBox;
  241.             checkBoxGrp -e -en off -v1 false exInConstraintsBox;
  242.             checkBoxGrp -e -en off -v1 false exInShadersBox;
  243.             break;
  244.         }
  245.     }
  246.  
  247.     return 1;
  248. }
  249.  
  250.  
  251. proc setOptionVars (string $action, int $forceFactorySettings)
  252. {
  253.     string $translators[];
  254.     string $optionName;
  255.     int $index;
  256.     string $defaultOptions;
  257.     global string $gAllOptionStrings[];
  258.     global int $gLastOptionSelectionIndex;
  259.     
  260.     if ($action == "Open") {
  261.         if ($forceFactorySettings || !`optionVar -exists defaultFileOpenType`) {
  262.             optionVar -stringValue defaultFileOpenType "Best Guess";
  263.         }
  264.         if ($forceFactorySettings || !`optionVar -exists fileExecuteSN`) {
  265.             optionVar -intValue fileExecuteSN true;
  266.         }
  267.         if ($forceFactorySettings || !`optionVar -exists fileLoadDeferRef`) {
  268.             optionVar -intValue fileLoadDeferRef false;
  269.         }
  270.     } else if ($action == "Import") {
  271.         if ($forceFactorySettings || !`optionVar -exists defaultFileImportType`) {
  272.             optionVar -stringValue defaultFileImportType "Best Guess";
  273.         }
  274.         if ($forceFactorySettings || !`optionVar -exists fileOptionsGrouping`) {
  275.             optionVar -intValue fileOptionsGrouping false;
  276.         }    
  277.         if ($forceFactorySettings || !`optionVar -exists fileOptionsRenameAll`) {
  278.             optionVar -intValue fileOptionsRenameAll false;
  279.         }
  280.         if ($forceFactorySettings || !`optionVar -exists useNamespacesDuringFileIO`) {
  281.             optionVar -intValue useNamespacesDuringFileIO false;
  282.         }    
  283.         if ($forceFactorySettings || ! `optionVar -exists fileOptionsUseRenamePrefix`) {
  284.             optionVar -intValue fileOptionsUseRenamePrefix false;
  285.         }
  286.         if ($forceFactorySettings || !`optionVar -exists fileOptionsRenamePrefix`) {
  287.             optionVar -stringValue fileOptionsRenamePrefix "";
  288.         }
  289.     } else if ($action == "Reference") {
  290.         if ($forceFactorySettings || !`optionVar -exists defaultFileReferenceType`) {
  291.             optionVar -stringValue defaultFileReferenceType "Best Guess";
  292.         }
  293.         if ($forceFactorySettings || !`optionVar -exists referenceOptionsGrouping`) {
  294.             optionVar -intValue referenceOptionsGrouping false;
  295.         }
  296.         if ($forceFactorySettings || !`optionVar -exists referenceUseNamespacesDuringFileIO`) {
  297.             optionVar -intValue referenceUseNamespacesDuringFileIO false;
  298.         }    
  299.         if ($forceFactorySettings || !`optionVar -exists referenceOptionsUseRenamePrefix`) {
  300.             optionVar -intValue referenceOptionsUseRenamePrefix false;
  301.         }
  302.         if ($forceFactorySettings || !`optionVar -exists referenceOptionsRenamePrefix `) {
  303.             optionVar -stringValue referenceOptionsRenamePrefix "";
  304.         }
  305.  
  306.     } else if ($action == "ExportAll") {
  307.         if ($forceFactorySettings || !`optionVar -exists defaultFileExportAllType`) {
  308.             optionVar -stringValue defaultFileExportAllType "mayaBinary";
  309.         }
  310.         if ($forceFactorySettings || !`optionVar -exists useDefaultFileExtensions`) {
  311.             optionVar -intValue useDefaultFileExtensions true;
  312.         }
  313.     } else if ($action == "ExportActive") {
  314.         if ($forceFactorySettings || !`optionVar -exists exportOptionsGrouping`) {
  315.             optionVar -intValue exportOptionsGrouping false;
  316.         }    
  317.         if ($forceFactorySettings || !`optionVar -exists exportUseNamespacesDuringFileIO`) {
  318.             optionVar -intValue exportUseNamespacesDuringFileIO false;
  319.         }
  320.  
  321.         if ($forceFactorySettings || !`optionVar -exists defaultFileExportActiveType`) {
  322.             optionVar -stringValue defaultFileExportActiveType "mayaBinary";
  323.         }
  324.         if ($forceFactorySettings || !`optionVar -exists exportOptionsUseRenamePrefix`) {
  325.             optionVar -intValue exportOptionsUseRenamePrefix false;
  326.         }
  327.         if ($forceFactorySettings || !`optionVar -exists exportOptionsRenamePrefix`) {
  328.             optionVar -stringValue exportOptionsRenamePrefix "";
  329.         }
  330.         //      Keep Only a Reference.
  331.         if ($forceFactorySettings || !`optionVar -exists exportKeepOnlyRef`) {
  332.                 optionVar -intValue exportKeepOnlyRef 0;
  333.         }
  334.         //      Include Inputs.
  335.         if ($forceFactorySettings || !`optionVar -exists exportIncludeInputs`) {
  336.                 optionVar -intValue exportIncludeInputs 1;
  337.         }
  338.         //      Include History.
  339.         if ($forceFactorySettings || !`optionVar -exists exportIncludeHistory`) {
  340.                 optionVar -intValue exportIncludeHistory 1;
  341.         }
  342.         //      Include Channels.
  343.         if ($forceFactorySettings || !`optionVar -exists exportIncludeChannels`) {
  344.                 optionVar -intValue exportIncludeChannels 1;
  345.         }
  346.         //      Include Expressions.
  347.         if ($forceFactorySettings || !`optionVar -exists exportIncludeExpressions`) {
  348.                 optionVar -intValue exportIncludeExpressions 1;
  349.         }
  350.         //      Include Constraints.
  351.         if ($forceFactorySettings || !`optionVar -exists exportIncludeConstraints`) {
  352.                 optionVar -intValue exportIncludeConstraints 1;
  353.         }
  354.         //      Include Shading Groups.
  355.         if ($forceFactorySettings || !`optionVar -exists exportIncludeShaders`) {
  356.                 optionVar -intValue exportIncludeShaders 1;
  357.         }
  358.         if ($forceFactorySettings || !`optionVar -exists useDefaultFileExtensions`) {
  359.             optionVar -intValue useDefaultFileExtensions true;
  360.         }
  361.     } else if ($action == "Save") {
  362.         // Incremental save options
  363.         //
  364.         if ($forceFactorySettings ||  !`optionVar -exists isIncrementalSaveEnabled`) {
  365.             optionVar -intValue isIncrementalSaveEnabled false;
  366.         }
  367.         if ($forceFactorySettings ||  !`optionVar -exists incrementalSaveLimitBackups`) {
  368.             optionVar -intValue incrementalSaveLimitBackups false;
  369.         }
  370.         if ($forceFactorySettings ||  !`optionVar -exists incrementalSaveMaxBackups`) {
  371.             optionVar -intValue incrementalSaveMaxBackups 20;
  372.         }
  373.     } else if ($action == "SaveAs") {
  374.         if ($forceFactorySettings || !`optionVar -exists defaultFileSaveType`) {
  375.             optionVar -stringValue defaultFileSaveType "mayaBinary";
  376.         }
  377.         if ($forceFactorySettings || !`optionVar -exists useDefaultFileExtensions`) {
  378.             optionVar -intValue useDefaultFileExtensions true;
  379.         }
  380.         if ($forceFactorySettings || !`optionVar -exists defaultTextureSaveAsType`) {
  381.             optionVar -stringValue defaultTextureSaveAsType "unlessRef";
  382.         }
  383.         if ($forceFactorySettings || !`optionVar -exists defaultDiskCacheSaveAsType`) {
  384.             optionVar -stringValue defaultDiskCacheSaveAsType "always";
  385.         }
  386.     }
  387.     
  388.     $translators = `translator -q -list`;
  389.     int $numOptionStrings = size($translators);
  390.     for ($index = 0; $index < $numOptionStrings; $index++) {
  391.         if ($translators[$index] == "directory") continue;
  392.         $optionName = ($translators[$index]+"Options");
  393.         if ($forceFactorySettings || !`optionVar -exists $optionName`) {
  394.             $defaultOptions = `translator -q -do $translators[$index]`;
  395.             optionVar -stringValue $optionName $defaultOptions;
  396.         }
  397.  
  398.         $gAllOptionStrings[$index] = `optionVar -q $optionName`;
  399.     }
  400.     $gLastOptionSelectionIndex = -1;
  401. }
  402.  
  403. //
  404. //  Procedure Name:
  405. //      incrementalSaveStoreOptions
  406. //
  407. //  Description:
  408. //      Updates the optionVars relating to incremental save options.
  409. //
  410. //  Input Arguments:
  411. //        None.
  412. //
  413. //  Return Value:
  414. //      None.
  415. //
  416. proc incrementalSaveStoreOptions() 
  417. {
  418.     // Incremental save options
  419.     //
  420.     int $incrementalSaveEnabled = `checkBoxGrp -q -v1 incrementalSaveEnabled`;
  421.     optionVar -intValue isIncrementalSaveEnabled $incrementalSaveEnabled;
  422.  
  423.     int $limitIncrementalSaves = `checkBoxGrp -q -v1 incrementalSaveLimit`;
  424.     optionVar -intValue incrementalSaveLimitBackups $limitIncrementalSaves;
  425.  
  426.     int $incrementalSaveLimit = `intSliderGrp -q -v incrementalSaveLimitNo`;
  427.     optionVar -intValue incrementalSaveMaxBackups $incrementalSaveLimit;
  428. }
  429.  
  430. //
  431. //  Procedure Name:
  432. //      incrementalSaveUpdateControls
  433. //
  434. //  Description:
  435. //      Updates the enabled/disabled state of the controls relating to 
  436. //        incremental save options.
  437. //
  438. //  Input Arguments:
  439. //        None.
  440. //
  441. //  Return Value:
  442. //      None.
  443. //
  444. global proc incrementalSaveUpdateControls() 
  445. {
  446.     int $enableLimitCheck = false, $enableLimitValue = false;
  447.  
  448.     if ( `checkBoxGrp -query -value1 incrementalSaveEnabled` ) {
  449.         $enableLimitCheck = true;
  450.  
  451.         if ( `checkBoxGrp -query -value1 incrementalSaveLimit` ) {
  452.             $enableLimitValue = true;
  453.         }
  454.     }
  455.  
  456.     checkBoxGrp -edit -enable $enableLimitCheck incrementalSaveLimit;
  457.     intSliderGrp -edit -enable $enableLimitValue incrementalSaveLimitNo;
  458.     
  459.     // For the incremental save options, we always store the new values into 
  460.     // the option vars immediately.  This goes against our normal UI rules, but
  461.     // it was found that users expected this behaviour in this case.
  462.     //
  463.     incrementalSaveStoreOptions();
  464. }
  465.  
  466. global proc fileOptionsSetup (string $parent, string $action, int $forceFactorySettings)
  467. {
  468.     string $fileType;
  469.     string $qFileType;
  470.     int $numTypes;
  471.     string $typeList[];
  472.     int $index;
  473.     
  474.     // Retrieve the option settings
  475.     //
  476.     setOptionVars ($action, $forceFactorySettings);
  477.     setParent $parent;
  478.  
  479.     if ($action == "Open") {
  480.         checkBoxGrp -edit
  481.             -v1 `optionVar -query fileExecuteSN`
  482.             foOpenExecuteSNGrp;
  483.  
  484.         checkBoxGrp -edit
  485.             -v1 `optionVar -query fileLoadDeferRef`
  486.             foOpenLoadDeferGrp;
  487.     }
  488.  
  489.     // Set the group item if needed.
  490.     if ($action == "Import" || $action == "Reference") {
  491.         string $groupingOptionVar = ($action == "Reference" ? "referenceOptionsGrouping" : "fileOptionsGrouping");
  492.         checkBoxGrp -edit
  493.             -v1 `optionVar -query $groupingOptionVar`
  494.             importGroupGrp;
  495.  
  496.         string $namespaceOptionVar = ($action == "Reference" ? "referenceUseNamespacesDuringFileIO" : "useNamespacesDuringFileIO");
  497.         checkBoxGrp -edit
  498.             -v1 `optionVar -query $namespaceOptionVar `
  499.             useNamespacesGrp;
  500.  
  501.         if ($action == "Import") {
  502.             if (`optionVar -q fileOptionsRenameAll`) {
  503.                 optionMenu -e -sl 2 nameClashOptions;
  504.             } else {
  505.                 optionMenu -e -sl 1 nameClashOptions;
  506.             }
  507.         }
  508.     }
  509.  
  510.     // Set the group item if needed.
  511.     if ($action == "ExportActive") {
  512.         checkBoxGrp -edit
  513.             -v1 `optionVar -query exportUseNamespacesDuringFileIO`
  514.             foExportActiveNSGrp;
  515.     }
  516.  
  517.     // Save As Options
  518.     switch ($action) {
  519.     case "Save":
  520.         // Incremental save options
  521.         //
  522.         int $incrementalSaveEnabled = `optionVar -query isIncrementalSaveEnabled`;
  523.         checkBoxGrp -edit -value1 $incrementalSaveEnabled incrementalSaveEnabled;
  524.  
  525.         int $limitIncrementalSaves = `optionVar -query incrementalSaveLimitBackups`;
  526.         checkBoxGrp -edit -value1 $limitIncrementalSaves incrementalSaveLimit;
  527.  
  528.         int $incrementalSaveLimit = `optionVar -query incrementalSaveMaxBackups`;
  529.         intSliderGrp -edit -value $incrementalSaveLimit incrementalSaveLimitNo;
  530.  
  531.         incrementalSaveUpdateControls();
  532.         break;
  533.  
  534.     case "SaveAs"        :
  535.         string $textOpt = `optionVar -query defaultTextureSaveAsType`; 
  536.         if ( $textOpt == "always" ) { 
  537.             radioButtonGrp -edit -sl 1 fo_saveAsTextureOption;
  538.         } else if ( $textOpt == "unlessRef" ) {
  539.             radioButtonGrp -edit -sl 2 fo_saveAsTextureOption;
  540.         } else if ( $textOpt == "never" ) {
  541.             radioButtonGrp -edit -sl 3 fo_saveAsTextureOption;
  542.         }
  543.  
  544.         string $diskCacheOpt = `optionVar -query defaultDiskCacheSaveAsType`; 
  545.         if ( $diskCacheOpt == "never" ) { 
  546.             radioButtonGrp -edit -sl 2 fo_saveAsDiskCacheOption;
  547.         } else {
  548.             radioButtonGrp -edit -sl 1 fo_saveAsDiskCacheOption;
  549.         }
  550.         // !!
  551.         // Fall Through to pick up the common control for file extensions...
  552.         // !!
  553.  
  554.     case "ExportAll"    :
  555.     case "ExportActive"    :
  556.         checkBoxGrp -edit
  557.             -v1 `optionVar -query useDefaultFileExtensions`
  558.             useDefFileExtensions;
  559.         break;
  560.     default                :
  561.         break;
  562.  
  563.     }
  564.  
  565.  
  566.     // Export Selected Options
  567.     if ($action == "ExportActive"){
  568.         checkBoxGrp -edit
  569.             -en on
  570.             -v1 `optionVar -query exportKeepOnlyRef`
  571.             exKeepRefBox;
  572.  
  573.         int $exportIncludeInputs = `optionVar -query exportIncludeInputs`;    
  574.         checkBoxGrp -edit
  575.             -en on -v1 $exportIncludeInputs
  576.             exInInputsBox;
  577.  
  578.         // If the "Include These Inputs" box is enabled, then enable
  579.         // and reset the sub options.  Otherwise disable the suboptions
  580.         // and turn them off.
  581.         if ( $exportIncludeInputs ) {
  582.             checkBoxGrp -edit
  583.                 -en on -v1 `optionVar -query exportIncludeHistory`
  584.                 exInHistoryBox;
  585.  
  586.             checkBoxGrp -edit
  587.                 -en on -v1 `optionVar -query exportIncludeChannels`
  588.                 exInChannelsBox;
  589.  
  590.             checkBoxGrp -edit
  591.                 -en on -v1 `optionVar -query exportIncludeExpressions`
  592.                 exInExpressionsBox;
  593.  
  594.             checkBoxGrp -edit
  595.                 -en on -v1 `optionVar -query exportIncludeConstraints`
  596.                 exInConstraintsBox;
  597.         } else {
  598.             checkBoxGrp -e -en off -v1 false exInHistoryBox;
  599.             checkBoxGrp -e -en off -v1 false exInChannelsBox;
  600.             checkBoxGrp -e -en off -v1 false exInExpressionsBox;
  601.             checkBoxGrp -e -en off -v1 false exInConstraintsBox;
  602.         }
  603.  
  604.         checkBoxGrp -edit
  605.             -en on -v1 `optionVar -query exportIncludeShaders`
  606.             exInShadersBox;
  607.     }
  608.         
  609.     if ($action != "Save") {
  610.         // Set the default read/write type.
  611.         if ($action == "Import") {
  612.             $fileType = `optionVar -q defaultFileImportType`;
  613.         } else if ($action == "Reference") {
  614.             $fileType = `optionVar -q defaultFileReferenceType`;
  615.         } else if ($action == "Open") {
  616.             $fileType = `optionVar -q defaultFileOpenType`;
  617.         } else if ($action == "SaveAs") {
  618.             $fileType = `optionVar -q defaultFileSaveType`;
  619.         } else if ($action == "ExportAll") {
  620.             $fileType = `optionVar -q defaultFileExportAllType`;
  621.         } else if ($action == "ExportActive") {
  622.             $fileType = `optionVar -q defaultFileExportActiveType`;
  623.         } else if ($action == "CreateReference") {
  624.             $fileType = `optionVar -q defaultFileCreateReferenceType`;
  625.         } 
  626.  
  627.         
  628.         $numTypes = `optionMenuGrp -q -ni fo_fileTypePopList`;
  629.         $typeList = `optionMenuGrp -q -ils fo_fileTypePopList`;
  630.         for ($index = 0; $index < $numTypes; $index++) {
  631.             $qFileType = `menuItem -q -l $typeList[$index]`;
  632.             if ($qFileType == $fileType) {
  633.                 optionMenuGrp -e -select ($index+1) fo_fileTypePopList;
  634.                 break;
  635.             }
  636.         }
  637.     
  638.         if ($action == "Import" || $action == "Reference") {
  639.             string $usePrefixOptionVar = ($action == "Reference" ? "referenceOptionsUseRenamePrefix" : "fileOptionsUseRenamePrefix");
  640.             int $userPrefix = `optionVar -q $usePrefixOptionVar `;
  641.             optionMenu -e -select ($userPrefix + 1) nameClash2OptionMenu;
  642.             if ($userPrefix) {
  643.                 string $renamePrefixOptionVar = ($action == "Reference" ? "referenceOptionsRenamePrefix" : "fileOptionsRenamePrefix");
  644.                 string $userPrefixStr = `optionVar -q $renamePrefixOptionVar`;
  645.                 textField  -e -tx $userPrefixStr nodeNamePrefix;
  646.             }
  647.             fo_prefixName ($action);
  648.         }
  649.  
  650.         if ($action == "ExportActive") {
  651.             int $userPrefix = `optionVar -q exportOptionsUseRenamePrefix`;
  652.             optionMenuGrp -e -select ($userPrefix + 1) foExportActiveNSMenu;
  653.             if ($userPrefix) {
  654.                 string $userPrefixStr = `optionVar -q exportOptionsRenamePrefix`;
  655.                 textField  -e -tx $userPrefixStr foExportActiveNSFld;
  656.             }
  657.             fo_exportActiveNSMenuChange;
  658.             fo_exportActiveKeepRefChanged;
  659.         }
  660.  
  661.         fo_newFileType $action;
  662.     }
  663.     
  664. }
  665.  
  666. global proc fileOptionsCallback (string $parent, string $action, string $actionProc)
  667. //
  668. //    Description:
  669. //        Initiate the action specified by the action button.
  670. //        (ie. Open, Import, Save, etc.)
  671. //
  672. {
  673.     global string $gFileOptionsString;
  674.     global string $gAllOptionStrings[];
  675.     global int $gLastOptionSelectionIndex;
  676.     global string $gLastOptionSelection;
  677.     string $fileType;
  678.     string $optionsScript;
  679.     
  680.     if ($action == "Open") {
  681.         int $useESN = `checkBoxGrp -q -v1 foOpenExecuteSNGrp`;
  682.         optionVar -intValue fileExecuteSN $useESN;
  683.  
  684.         int $loadDefer = `checkBoxGrp -q -v1 foOpenLoadDeferGrp`;
  685.         optionVar -intValue fileLoadDeferRef $loadDefer;
  686.     }
  687.  
  688.     // First find out what the user has given us.
  689.     if ($action == "Import" || $action == "Reference") {
  690.         int $useGrp = `checkBoxGrp -q -v1 importGroupGrp`;
  691.         string $groupingOptionVar = ($action == "Reference" ? "referenceOptionsGrouping" : "fileOptionsGrouping");
  692.         optionVar -intValue $groupingOptionVar $useGrp;
  693.  
  694.         int $useNS = `checkBoxGrp -q -v1 useNamespacesGrp`;
  695.         string $namespaceOptionVar = ($action == "Reference" ? "referenceUseNamespacesDuringFileIO" : "useNamespacesDuringFileIO");
  696.         optionVar -intValue $namespaceOptionVar $useNS;
  697.  
  698.  
  699.         int $useNamePrefix = `optionMenu -q -sl nameClash2OptionMenu`;
  700.         string $usePrefixOptionVar = ($action == "Reference" ? "referenceOptionsUseRenamePrefix" : "fileOptionsUseRenamePrefix");
  701.         if ($useNamePrefix == 1) {
  702.             optionVar -intValue $usePrefixOptionVar false;
  703.         } else {
  704.             optionVar -intValue $usePrefixOptionVar true;
  705.         }
  706.  
  707.         string $namePrefix = `textField -q -tx nodeNamePrefix`;
  708.         if (size($namePrefix) > 0) {
  709.             string $renamePrefixOptionVar = ($action == "Reference" ? "referenceOptionsRenamePrefix" : "fileOptionsRenamePrefix");
  710.             optionVar -stringValue $renamePrefixOptionVar $namePrefix;
  711.         }
  712.  
  713.         if ($action == "Import") {
  714.             int $selected = `optionMenu -q -sl nameClashOptions`;
  715.             if ($selected == 1) {
  716.                 optionVar -intValue fileOptionsRenameAll false;
  717.             } else {
  718.                 optionVar -intValue fileOptionsRenameAll true;
  719.             }
  720.         }
  721.     }
  722.  
  723.     if ($action == "ExportActive") {
  724.         int $useNS = `checkBoxGrp -q -v1 foExportActiveNSGrp`;
  725.         optionVar -intValue exportUseNamespacesDuringFileIO $useNS;
  726.  
  727.         int $useNamePrefix = `optionMenuGrp -q -sl foExportActiveNSMenu`;
  728.         if ($useNamePrefix == 1) {
  729.             optionVar -intValue exportOptionsUseRenamePrefix false;
  730.         } else {
  731.             optionVar -intValue exportOptionsUseRenamePrefix true;
  732.         }
  733.  
  734.         string $namePrefix = `textField -q -tx foExportActiveNSFld`;
  735.         if (size($namePrefix) > 0) {
  736.             optionVar -stringValue exportOptionsRenamePrefix $namePrefix;
  737.         }
  738.     }
  739.     
  740.     // Set the default read/write type.
  741.     
  742.     if ($action != "Save") {
  743.         $fileType = `optionMenuGrp -q -v fo_fileTypePopList`;
  744.     }
  745.     if ($action == "Import") {
  746.         optionVar -stringValue defaultFileImportType $fileType;
  747.     } else if ($action == "Reference") {
  748.         optionVar -stringValue defaultFileReferenceType $fileType;
  749.     } else if ($action == "Open") {
  750.         optionVar -stringValue defaultFileOpenType $fileType;
  751.     } else {
  752.         if ($fileType == "Best Guess") {
  753.             $fileType = "mayaBinary";
  754.         }
  755.  
  756.         if ($action == "Save") {
  757.             incrementalSaveStoreOptions();
  758.            } else if ($action == "SaveAs") {
  759.             optionVar -stringValue defaultFileSaveType $fileType;
  760.             int $useFileExtensions = `checkBoxGrp -q -v1 useDefFileExtensions`;
  761.             optionVar -iv useDefaultFileExtensions $useFileExtensions;
  762.             file -defaultExtensions $useFileExtensions;
  763.             int $butt = `radioButtonGrp -q -sl fo_saveAsTextureOption`;
  764.             string $saveAsTexture = "";
  765.             if ( 1 == $butt )        $saveAsTexture = "always";
  766.             else if ( 2 == $butt ) $saveAsTexture = "unlessRef";
  767.             else if ( 3 == $butt ) $saveAsTexture = "never";
  768.             optionVar -stringValue defaultTextureSaveAsType $saveAsTexture;
  769.             file -saveTextures $saveAsTexture;
  770.             int $buttDC = `radioButtonGrp -q -sl fo_saveAsDiskCacheOption`;
  771.             string $saveAsDiskCache = "";
  772.             if ( 2 == $buttDC )      
  773.                 $saveAsDiskCache = "never";
  774.             else 
  775.                 $saveAsDiskCache = "always";
  776.             optionVar -stringValue defaultDiskCacheSaveAsType $saveAsDiskCache;
  777.             file -saveDiskCache $saveAsDiskCache;
  778.         } else if ($action == "ExportAll") {
  779.             optionVar -stringValue defaultFileExportAllType $fileType;
  780.             int $useFileExtensions = `checkBoxGrp -q -v1 useDefFileExtensions`;
  781.             optionVar -iv useDefaultFileExtensions $useFileExtensions;
  782.             file -defaultExtensions $useFileExtensions;
  783.         } else if ($action == "ExportActive") {
  784.             optionVar -stringValue defaultFileExportActiveType $fileType;
  785.             if ( $fileType == "mayaAscii" ||
  786.                  $fileType == "mayaBinary" ||
  787.                  $fileType == "mayaPLE" ||
  788.                  $fileType == "Best Guess" ) {
  789.                 // Only save the value of these option boxes if the current
  790.                 // format is one for which they apply.  They are forced off
  791.                 // for other formats, and we want to preserve their last
  792.                 // value for the next time a supported format is used.
  793.                 optionVar -iv exportKeepOnlyRef
  794.                     `checkBoxGrp -q -v1 exKeepRefBox`;
  795.                 optionVar -iv exportIncludeInputs
  796.                     `checkBoxGrp -q -v1 exInInputsBox`;
  797.                 optionVar -iv exportIncludeHistory
  798.                     `checkBoxGrp -q -v1 exInHistoryBox`;
  799.                 optionVar -iv exportIncludeChannels
  800.                     `checkBoxGrp -q -v1 exInChannelsBox`;
  801.                 optionVar -iv exportIncludeExpressions
  802.                     `checkBoxGrp -q -v1 exInExpressionsBox`;
  803.                 optionVar -iv exportIncludeConstraints
  804.                     `checkBoxGrp -q -v1 exInConstraintsBox`;
  805.                 optionVar -iv exportIncludeShaders
  806.                     `checkBoxGrp -q -v1 exInShadersBox`;
  807.             }
  808.             int $useFileExtensions = `checkBoxGrp -q -v1 useDefFileExtensions`;
  809.             optionVar -iv useDefaultFileExtensions $useFileExtensions;
  810.             file -defaultExtensions $useFileExtensions;
  811.         } else if ($action == "CreateReference") {
  812.             optionVar -stringValue defaultFileCreateReferenceType $fileType;
  813.         }
  814.     }
  815.     
  816.     if ($fileType != "Best Guess") {    // We need to determine the type.
  817.         $optionsScript = `translator -q -os $fileType`;
  818.     }
  819.  
  820.     if ($optionsScript != "") {
  821.         // Get the new options.
  822.         // Sets $gFileOptionsString
  823.         eval($optionsScript+" fileOptionsScroll \"query\" \"\" fo_optionsCallback");
  824.     } else {
  825.         $gFileOptionsString = "";
  826.     }
  827.  
  828.     $gLastOptionSelectionIndex = -1;    // Assume not found
  829.  
  830.     string $translators[] = `translator -q -list`;
  831.     int $numTranslators = size($translators);
  832.     for ($index = 0; $index < $numTranslators; $index++) {
  833.         if ($translators[$index] == "directory") continue;
  834.  
  835.         if ($fileType == $translators[$index]) {
  836.             $gAllOptionStrings[$index] = $gFileOptionsString;
  837.         }
  838.  
  839.         $optionName = ($translators[$index]+"Options");
  840.         optionVar -stringValue $optionName $gAllOptionStrings[$index];
  841.     }
  842.  
  843.  
  844.     // Clean up.
  845.     $gLastOptionSelectionIndex = -1;
  846.     string $empty[];
  847.     $gAllOptionStrings = $empty;
  848.  
  849.     if ($actionProc != "") {
  850.         // Invoke the subsequent option.
  851.         eval($actionProc);
  852.     }
  853. }
  854.  
  855. proc string fileOptionsTabPage (string $action, string $tabLayout)
  856. {
  857.     int $numTypes;
  858.     string $fileTypes[];
  859.     int $index;
  860.     string $tabForm;
  861.     int $readOptions;
  862.     
  863.     setParent $tabLayout;
  864.     
  865.     $tabForm = `tabLayout -tabsVisible 0 -scrollable 1`;
  866.     string $topForm = `formLayout optionsBoxForm`;
  867.     
  868.         formLayout actionOptionsForm;
  869.             if ($action == "Import" || $action == "Reference") {
  870.                 // We need to ask for grouping information.
  871.                 columnLayout genOptionsLayout;
  872.                     checkBoxGrp -numberOfCheckBoxes 1 
  873.                         -label "Group" -label1 "" 
  874.                         importGroupGrp;
  875.  
  876.                     checkBoxGrp -numberOfCheckBoxes 1 
  877.                         -label "Use Namespaces" -label1 "" 
  878.                         useNamespacesGrp;
  879.  
  880.                     separator -w 490; 
  881.                     formLayout nameClashForm;
  882.                     text -l "Name clash options:" nameClassTitle;
  883.                     
  884.                     if ($action == "Reference") {
  885.                         optionMenu -l "Resolve" nameClashOptions;
  886.                             menuItem -l "all nodes"    prefixOptionMenu1;
  887.                     } else {
  888.                         optionMenu -l "Resolve" nameClashOptions;
  889.                             menuItem -l "clashing nodes" prefixOptionMenu1;
  890.                             menuItem -l "all nodes"    prefixOptionMenu2;
  891.                     }
  892.  
  893.                     optionMenu -l "with" -cc ("fo_prefixName (\"" + $action + "\")") nameClash2OptionMenu;
  894.                         menuItem -l "the file name" prefixOptionMenu3;
  895.                         menuItem -l "this string:" prefixOptionMenu4;
  896.  
  897.                     textField -w 152 nodeNamePrefix;
  898.  
  899.                     formLayout -e 
  900.                         -af nameClassTitle top 5
  901.                         -af nameClassTitle left 6
  902.                         -ac nameClashOptions top 5 nameClassTitle
  903.                         -af nameClashOptions left 10 
  904.                         -ac nameClash2OptionMenu top 5 nameClassTitle
  905.                         -ac nameClash2OptionMenu left 0 nameClashOptions
  906.                         -ac nodeNamePrefix top 5 nameClassTitle  
  907.                         -ac nodeNamePrefix left 3 nameClash2OptionMenu
  908.                         nameClashForm;
  909.                             
  910.                     setParent ..; 
  911.                     separator -w 490; 
  912.  
  913.                 $readOptions = 1;
  914.                 
  915.             } else if ($action == "Open") {
  916.                 $readOptions = 1;
  917.             } else {
  918.                 $readOptions = 0;
  919.             }
  920.  
  921.             setParent actionOptionsForm;
  922.             if ($action != "Save") {
  923.                 optionMenuGrp -l "File Type" -cc ("fo_newFileType "+$action)
  924.                     -cat 1 "left" 5 -cw 1 65 fo_fileTypePopList;
  925.                     if ($readOptions) {
  926.                         menuItem -l "Best Guess" "fo_AnyfileTypeMenu";
  927.                     }
  928.                     $fileTypes = `translator -q -l`;
  929.                     $numTypes = size($fileTypes);
  930.                     for ($index = 0; $index < $numTypes; $index++) {
  931.                         if ($readOptions) {
  932.                             if (`translator -q -rs $fileTypes[$index]`) {
  933.                                 menuItem -l $fileTypes[$index] ($fileTypes[$index]+"fo_fileTypeMenu");
  934.                             }
  935.                         } else if (`translator -q -ws $fileTypes[$index]`) {
  936.                             if ($action == "SaveAs") {
  937.                                 if ($fileTypes[$index] == "mayaAscii"
  938.                                     || $fileTypes[$index] == "mayaPLE"
  939.                                     || $fileTypes[$index] == "mayaBinary") {
  940.                                     menuItem -l $fileTypes[$index] ($fileTypes[$index]+"fo_fileTypeMenu");
  941.                                 }
  942.                             } else {
  943.                                 menuItem -l $fileTypes[$index] ($fileTypes[$index]+"fo_fileTypeMenu");
  944.                             }
  945.                         }
  946.                     }
  947.             }
  948.  
  949.             if ($action == "Open") {
  950.                 setUITemplate -pushTemplate DefaultTemplate;
  951.                 columnLayout openOptionColumn;
  952.                     separator -w 490;
  953.  
  954.                     checkBoxGrp -ncb 1 
  955.                         -label "Execute Script Nodes" -label1 "" 
  956.                         foOpenExecuteSNGrp;
  957.  
  958.                     checkBoxGrp -ncb 1 
  959.                         -label "Load Deferred References" -label1 "" 
  960.                         foOpenLoadDeferGrp;
  961.  
  962.                 formLayout -e
  963.                     -af fo_fileTypePopList top 0
  964.                     -af fo_fileTypePopList left 0
  965.                     -ac openOptionColumn top 0 fo_fileTypePopList
  966.                     -af openOptionColumn left 0
  967.                     -af openOptionColumn bottom 0
  968.                     -af openOptionColumn right 0
  969.                     actionOptionsForm;
  970.                 setUITemplate -popTemplate;
  971.             }
  972.                  
  973.             if ($action == "Import" || $action == "Reference") {
  974.                  formLayout -e 
  975.                     -ac fo_fileTypePopList top 5 genOptionsLayout
  976.                     -af fo_fileTypePopList left 0
  977.                     actionOptionsForm;
  978.             } else if ($action != "Save") {
  979.                  formLayout -e 
  980.                     -af fo_fileTypePopList top 0
  981.                     -af fo_fileTypePopList left 0
  982.                     actionOptionsForm;
  983.             }
  984.  
  985.             if ($action == "Save" || $action == "SaveAs" 
  986.                     || $action == "ExportAll"){
  987.                 setUITemplate -pushTemplate DefaultTemplate;
  988.                 columnLayout saveAsOptionColumn;
  989.                 if ( $action == "SaveAs" || $action == "ExportAll"){
  990.                     separator -w 490;
  991.                     checkBoxGrp -numberOfCheckBoxes 1
  992.                         -label "Default File Extensions"
  993.                         -label1 "" useDefFileExtensions;
  994.  
  995.                     formLayout -e
  996.                         -af fo_fileTypePopList top 0
  997.                         -af fo_fileTypePopList left 0
  998.                         -ac saveAsOptionColumn top 0 fo_fileTypePopList
  999.                         -af saveAsOptionColumn left 0
  1000.                         -af saveAsOptionColumn bottom 0
  1001.                         -af saveAsOptionColumn right 0
  1002.                         actionOptionsForm;
  1003.                 }
  1004.                 if ( $action == "Save" ) {
  1005.                     
  1006.                     // Incremental save options
  1007.                     //
  1008.                     checkBoxGrp -label1 "Incremental Save"
  1009.                         -changeCommand1 "incrementalSaveUpdateControls"
  1010.                         incrementalSaveEnabled;
  1011.  
  1012.                     checkBoxGrp -label1 "Limit Incremental Saves"
  1013.                         -changeCommand1 "incrementalSaveUpdateControls"
  1014.                         incrementalSaveLimit;
  1015.  
  1016.                     intSliderGrp -label "Number of Increments"
  1017.                         -min 1
  1018.                         -max 100
  1019.                         incrementalSaveLimitNo;
  1020.                 }
  1021.                 if ( $action == "SaveAs" ) {
  1022.                     //
  1023.                     separator -w 490;
  1024.                     text -l " 3D Paint Texture Options: ";
  1025.                     text -l "";
  1026.                     text -l "           Copy Texture Maps on Save Scene As ";
  1027.                     radioButtonGrp -l "" -nrb 3 -cw4 50 100 150 100 
  1028.                         -l1 "Always" -l2 "Unless Referenced" -l3 "Never"
  1029.                     fo_saveAsTextureOption;
  1030.  
  1031.                     separator -w 490;
  1032.                     text -l " Disk Cache Options: ";
  1033.                     text -l "";
  1034.                     text -l "           Copy Jiggle Disk Cache Files on Save Scene As ";
  1035.                     radioButtonGrp -l "" -nrb 2 -cw3 50 100 150
  1036.                         -l1 "Always" -l2 "Never"
  1037.                     fo_saveAsDiskCacheOption;
  1038.                 }
  1039.                 setUITemplate -popTemplate;
  1040.             }
  1041.  
  1042.             if ($action == "ExportActive"){
  1043.                 setUITemplate -pushTemplate DefaultTemplate;
  1044.                 columnLayout exportOptionColumn;
  1045.                 separator -w 490;
  1046.                 checkBoxGrp -numberOfCheckBoxes 1
  1047.                     -label "Default File Extensions"
  1048.                     -label1 "" useDefFileExtensions;
  1049.  
  1050.                 formLayout -e
  1051.                     -af fo_fileTypePopList top 0
  1052.                     -af fo_fileTypePopList left 0
  1053.                     -ac exportOptionColumn top 0 fo_fileTypePopList
  1054.                     -af exportOptionColumn left 0
  1055.                     -af exportOptionColumn bottom 0
  1056.                     -af exportOptionColumn right 0
  1057.                     actionOptionsForm;
  1058.  
  1059.                 separator -w 490;
  1060.  
  1061.                 checkBoxGrp
  1062.                     -changeCommand fo_exportActiveKeepRefChanged
  1063.                     -numberOfCheckBoxes 1
  1064.                     -label "Keep Only a Reference"
  1065.                     -label1 ""
  1066.                 exKeepRefBox;
  1067.  
  1068.                 columnLayout foExportActiveReferenceLyt;
  1069.  
  1070.                 checkBoxGrp
  1071.                     -numberOfCheckBoxes 1
  1072.                     -label "Use Namespaces"
  1073.                     -label1 ""
  1074.                     foExportActiveNSGrp;
  1075.  
  1076.                 rowLayout     -nc 2 
  1077.                             -cw2 340 200 
  1078.                             -ct2 "left" "left" 
  1079.                             -cl2 "left" "left" -adj 2 
  1080.                             foExportActiveNSLyt;
  1081.  
  1082.                         optionMenuGrp -l "Prefix with:" 
  1083.                                 -cw 2 125
  1084.                                 -cc fo_exportActiveNSMenuChange
  1085.                                 foExportActiveNSMenu;
  1086.                         menuItem -l "the file name";
  1087.                         menuItem -l "this string";
  1088.     
  1089.                     textField -w 152 foExportActiveNSFld;
  1090.                 setParent ..;
  1091.                 setParent ..;
  1092.                     
  1093.                 separator -w 490;
  1094.  
  1095.                 checkBoxGrp
  1096.                     -ncb 1
  1097.                     -l ""
  1098.                     -l1 "Include These Inputs:"
  1099.                     -cw 1 100
  1100.                     -onCommand
  1101.                      ("checkBoxGrp -e -enable on -v1 on exInHistoryBox;"+
  1102.                       "checkBoxGrp -e -enable on -v1 on exInChannelsBox;"+
  1103.                       "checkBoxGrp -e -enable on -v1 on exInExpressionsBox;"+
  1104.                       "checkBoxGrp -e -enable on -v1 on exInConstraintsBox;")
  1105.                     -offCommand
  1106.                      ("checkBoxGrp -e -enable off -v1 off exInHistoryBox;"+
  1107.                       "checkBoxGrp -e -enable off -v1 off exInChannelsBox;"+
  1108.                       "checkBoxGrp -e -enable off -v1 off exInExpressionsBox;"+
  1109.                       "checkBoxGrp -e -enable off -v1 off exInConstraintsBox;")
  1110.                     exInInputsBox;
  1111.  
  1112.                 columnLayout -adjustableColumn 1 exportOptionColumn;
  1113.  
  1114.                     checkBoxGrp
  1115.                         -ncb 1
  1116.                         -l1 "History"
  1117.                         exInHistoryBox;
  1118.  
  1119.                     checkBoxGrp
  1120.                         -ncb 1
  1121.                         -l1 "Channels"
  1122.                         exInChannelsBox;
  1123.  
  1124.                     checkBoxGrp
  1125.                         -ncb 1
  1126.                         -l1 "Expressions"
  1127.                         exInExpressionsBox;
  1128.  
  1129.                     checkBoxGrp
  1130.                         -ncb 1
  1131.                         -l1 "Constraints"
  1132.                         exInConstraintsBox;
  1133.  
  1134.                 setParent "..";
  1135.  
  1136.                 checkBoxGrp
  1137.                     -ncb 1
  1138.                     -l " "
  1139.                     -l1 "Include Texture Info"
  1140.                     -cw 1 100
  1141.                     exInShadersBox;
  1142.         
  1143.                 setUITemplate -popTemplate;
  1144.             }    
  1145.                 
  1146.                 
  1147.         setParent $topForm;
  1148.         columnLayout fileOptionsScroll;
  1149.     
  1150.         formLayout -e -af actionOptionsForm top 0
  1151.                     -af actionOptionsForm left 0
  1152.                     -af actionOptionsForm right 0
  1153.                     -ac fileOptionsScroll top 5 actionOptionsForm
  1154.                     -af fileOptionsScroll left 5 
  1155.                     -af fileOptionsScroll right 5 
  1156.                     -af fileOptionsScroll bottom 0
  1157.                     optionsBoxForm;
  1158.  
  1159.     return $tabForm;
  1160. }
  1161.  
  1162.  
  1163. global proc fileOptions (string $action, string $actionProc)
  1164. {
  1165.     string $cmdName        = "fileOptions";
  1166.     string $optionBoxTitle;
  1167.     string $actionName;
  1168.  
  1169.     if($action == "Open") $actionName = "Open";
  1170.     else if ($action == "Import") $actionName = "Import";
  1171.     else if ($action == "Reference") $actionName = "Reference";
  1172.     else if ($action == "Save") $actionName = "Save Scene";
  1173.     else if ($action == "SaveAs") $actionName = "Save Scene As";
  1174.     else if ($action == "ExportAll") $actionName = "Export All";
  1175.     else if ($action == "ExportActive") $actionName = "Export Selection";
  1176.     
  1177.     $optionBoxTitle = ($actionName+" Options");
  1178.     
  1179.     // Build the option box "methods"
  1180.     //
  1181.     string $callback = ($cmdName + "Callback");
  1182.     string $setup = ($cmdName + "Setup");
  1183.  
  1184.  
  1185.     // Build the window, with a tab layout
  1186.     //
  1187.     setUITemplate -pushTemplate DefaultTemplate;
  1188.     string $widgetList[] = `getStandardWindow $optionBoxTitle 1 "noScroll"`;
  1189.  
  1190.     setOptionBoxCommandName($actionName);
  1191.  
  1192.     // Make the form invisible while we create the widgets in the window
  1193.     //
  1194.     formLayout -e -vis false $widgetList[1];
  1195.  
  1196.  
  1197.     // Attach each tab
  1198.     //
  1199.     string $tabPage = `fileOptionsTabPage $action $widgetList[2]`;
  1200.     tabLayout -e -tabLabel $tabPage "Basic" $widgetList[2];
  1201.  
  1202.     // Attach the standard buttons
  1203.     //
  1204.     string $buttonList[] =
  1205.     `addStandardButtons $cmdName $actionName $widgetList[1] $widgetList[2] "noOptions"`;
  1206.  
  1207.     // attach commands to the standard buttons
  1208.     //
  1209.     button -e -command ("hideOptionBox") $buttonList[2];
  1210.     button -e -command ($setup + " " + $widgetList[0] + " " + $action + " true") 
  1211.         $buttonList[1];
  1212.     button -e -command ($callback+" "+$widgetList[0]+" "+$action+" \""+$actionProc+"\"") 
  1213.         $buttonList[0];
  1214.  
  1215.  
  1216.     // Make the form layout visible so we can see what we built, and
  1217.     // reset the template
  1218.     //
  1219.     formLayout -e -vis true $widgetList[1];
  1220.     setUITemplate -popTemplate;
  1221.  
  1222.     button -e -command ($callback+" "+$widgetList[0]+" "+$action+" \"\"") 
  1223.         $buttonList[3];
  1224.  
  1225.     //    Customize the 'Help' menu item text.
  1226.     //
  1227.     switch ($action) {
  1228.         case "Open":
  1229.             setOptionBoxHelpTag( "OpenSceneOptions" );
  1230.             break;
  1231.         case "Import":
  1232.             setOptionBoxHelpTag( "ImportOptions" );
  1233.             break;
  1234.         case "Reference":
  1235.             setOptionBoxHelpTag( "CreateReferenceOptions" );
  1236.             break;
  1237.         case "Save":
  1238.             setOptionBoxHelpTag( "SaveSceneOptions" );
  1239.             break;
  1240.         case "SaveAs":
  1241.             setOptionBoxHelpTag( "SaveSceneAsOptions" );
  1242.             break;
  1243.         case "ExportAll":
  1244.             setOptionBoxHelpTag( "ExportAllOptions" );
  1245.             break;
  1246.         case "ExportActive":
  1247.             setOptionBoxHelpTag( "ExportSelectionOptions" );
  1248.             break;
  1249.     }
  1250.  
  1251.  
  1252.     // Call the setup "method" to fill in the current settings
  1253.     //
  1254.     eval (($setup + " " + $widgetList[0] + " " + $action + " false"));    
  1255.     showOptionBox();
  1256.     showWindow $widgetList[0];
  1257. }
  1258.